﻿/****************************************************** 
Copyright (C) 2014 大庆正中科技有限公司版权所有
文件名: MySubmit.cs
功能描述:我的提交
创建者:曹彬
创建日期:2014-03-26
修改者:
修改日期:
******************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using XMK.Tadong.Biz;
using System.Configuration;
using HU8.Helpers.Files;
using System.Web.UI.HtmlControls;

namespace XMK.Tadong.Web.WebFileExplorer
{
    public partial class MySubmit : System.Web.UI.Page
    {
        #region 事件处理程序

        //页面加载程序
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                initData();
            }
        }

        //GridView命令行处理程序
        protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //重新提交
            if (e.CommandName.Equals("ResetSubmit"))
            {
 
            }
            //放弃提交
            if (e.CommandName.Equals("BackSubmit"))
            {
                TB_TEAM_FILEBiz bll = new TB_TEAM_FILEBiz();
                string File_ID = e.CommandArgument.ToString();
                string[] File_IDS = File_ID.Split('&');
                if (bll.Delete(File_IDS[0]))
                {
                    //获取存放路径
                    string save_Path = ConfigurationManager.AppSettings["DiskPath"];
                    save_Path += File_IDS[1].ToString();
                    //文档名称
                    string FILE_NAME= gvData.Rows[0].Cells[1].Text.ToString();
                    string[] FILE_NAMES = FILE_NAME.Split('.');
                    //删除文件
                    //1、删除源文件
                    FileHelper.DeleteFile(save_Path +"/"+ FILE_NAME);
                    //2、删除PDF文件
                    FileHelper.DeleteFile(save_Path + "/" + FILE_NAMES[0] + ".pdf");
                    //3、删除swf文件
                    FileHelper.DeleteFile(save_Path + "/" + FILE_NAMES[0] + ".swf");
                    initData();
                }
            }
        }

        //GridView行绑定事件
        protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lblStatus = (Label)e.Row.FindControl("lblStatus");
                Label lblStatus1 = (Label)e.Row.FindControl("lblStatus1");
                if (lblStatus.Text == "0")
                {
                    HtmlGenericControl btnResetSubmit = (HtmlGenericControl)e.Row.FindControl("div");
                    btnResetSubmit.Visible = false;
                    lblStatus1.Text = "未审核";
                }
                else if (lblStatus.Text == "1")
                {
                    HtmlGenericControl btnResetSubmit = (HtmlGenericControl)e.Row.FindControl("div");
                    btnResetSubmit.Visible = false;
                    lblStatus1.Text = "已审核";
                }
                else if (lblStatus.Text == "2")
                {
                    HtmlGenericControl btnResetSubmit = (HtmlGenericControl)e.Row.FindControl("div");
                    btnResetSubmit.Visible = true;
                    lblStatus1.Text = "已退回";
                }
            }

        }

        #endregion 事件处理程序

        #region 函数集

        //页面加载函数
        public void initData()
        {
            //获取当前登录的ID
            string user_id = "1";
            TB_TEAM_FILEBiz bll = new TB_TEAM_FILEBiz ();
            //gvData.DataSource = bll.GetMySubmitModel(user_id);
            //gvData.DataBind();
        }

        #endregion 函数集

       

      

    }
}